package cn.lang.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import java.security.PrivilegedAction;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.ReentrantLock;

@Component
public class LangThreadPool {

    @Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    public static void main(String[] args) throws Exception {
        LangThreadPool langThreadPool = new LangThreadPool();
        langThreadPool.run();


    }

    public void run() throws ExecutionException, InterruptedException {

        Callable<Object> callable = Executors.callable((PrivilegedAction<?>) () -> {
            System.out.println(11);
            return 1;
        });

        ExecutorService executorService = Executors.newFixedThreadPool(2);

        /*Future<?> future = threadPoolTaskExecutor.submit(() -> {
            System.out.println(2);
        });*/
    }

}
